#!/bin/bash

set -e

if [ $# -ne 1 ]; then
    echo "run-parts <directory>"
    exit 1
fi

dir=$1
if [[ "${dir}" = "" || ! -d "${dir}" ]]; then
    echo "run-parts <directory>"
    exit 1
fi

for f in $(echo ${dir%/}/*); do
	[ -d $f ] && continue
	[ ! -x $f ] && continue
	echo "+$f"
	$f
done